//
//  AccountTool.m
//  CommunityNannyO2O
//
//  Created by apple on 15/8/17.
//  Copyright (c) 2015年 Apple. All rights reserved.
//

#import "AccountTool.h"
#import "SIAlertView.h"
#import "UIViewController+Create.h"

@implementation AccountTool


+ (void)LoginWithUserId:(NSString *)userId
                 MidiId:(NSString *)midiId
               NickName:(NSString *)nickName
               RealName:(NSString *)realName
                  Email:(NSString *)email
                  Phone:(NSString *)phone
               National:(NSString *)national
                    Sex:(NSString *)sex
                 People:(NSString *)people
                 IdCard:(NSString *)idCard
               Birthday:(NSString *)birthday
                HeadImg:(NSString *)headImg
{

    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    
    [userDefaults setObject:userId forKey:kUserId];
    [userDefaults setObject:midiId forKey:KMidiId];
    [userDefaults setObject:nickName forKey:KNickName];
    [userDefaults setObject:realName forKey:KRealName];
    [userDefaults setObject:email forKey:KEamil];
    [userDefaults setObject:phone forKey:KPhone];
    [userDefaults setObject:national forKey:KNationality];
    [userDefaults setObject:sex forKey:KSex];
    [userDefaults setObject:people forKey:KPeople];
    [userDefaults setObject:idCard forKey:KIdCard];
    [userDefaults setObject:birthday  forKey:KBirthday];
    [userDefaults setObject:headImg forKey:KHeadImg];
    
    [userDefaults synchronize];
}

+ (void)loginOut{

     NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];

    [userDefaults removeObjectForKey:kUserId];
    [userDefaults removeObjectForKey:KMidiId];
    [userDefaults removeObjectForKey:KNickName];
    [userDefaults removeObjectForKey:KRealName];
    [userDefaults removeObjectForKey:KEamil];
    [userDefaults removeObjectForKey:KPhone];
    [userDefaults removeObjectForKey:KNationality];
    [userDefaults removeObjectForKey:KSex];
    [userDefaults removeObjectForKey:KPeople];
    [userDefaults removeObjectForKey:KIdCard];
    [userDefaults removeObjectForKey:KBirthday];
    [userDefaults removeObjectForKey:KHeadImg];
    
    [userDefaults synchronize];

}

+ (BOOL)checkLogin{

    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];

    if ([userDefaults objectForKey:kUserId] == nil) {
        return NO;
    }else {
    
        return YES;
    }
}

+ (NSString *)takeUserId{

    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    
    return [userDefaults objectForKey:kUserId];
}

+ (NSString *)takeClientId
{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    
    return [userDefaults objectForKey:kClientId];
}

+ (NSString *)takeMidiId{
    
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    
    return [userDefaults objectForKey:KMidiId];
}

+ (NSString *)takeNickName{
    
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    
    return [userDefaults objectForKey:KNickName];
}

+ (NSString *)takeRealName{
    
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    
    return [userDefaults objectForKey:KRealName];
}

+ (NSString *)takeEmail{
    
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    
    return [userDefaults objectForKey:KEamil];
}

+ (NSString *)takePhone{
    
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    
    return [userDefaults objectForKey:KPhone];
}


+ (NSString *)takeNational{
    
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    
    return [userDefaults objectForKey:KNationality];
}

+ (NSString *)takeSex{
    
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    
    return [userDefaults objectForKey:KSex];
}

+ (NSString *)takePeople{
    
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    
    return [userDefaults objectForKey:KPeople];
}

+ (NSString *)takeIdCard
{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    
    return [userDefaults objectForKey:KIdCard];
}

+ (NSString *)takeBirthday
{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    
    return [userDefaults objectForKey:KBirthday];
}

+ (NSString *)takeHeadImg
{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    
    return [userDefaults objectForKey:KHeadImg];
}

+ (void)setGeTuiClientId:(NSString *)clientId
{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    
    [userDefaults setObject:clientId forKey:kClientId];
}

+ (void)savePayItem:(NSString *)item
{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    [userDefaults setObject:item forKey:KPayItem];
}

+ (void)savePayMusicPopToView:(NSString *)item
{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    [userDefaults setObject:item forKey:KPayBuyMusicPopToInterface];
}

+ (void)savePayResult:(NSString *)item
{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    [userDefaults setObject:item forKey:KPayResult];
}

+ (void)saveExamId:(NSString *)examId
{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    [userDefaults setObject:examId forKey:KExamId];
}

+ (void)saveOrderId:(NSString *)orderId
{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    [userDefaults setObject:orderId forKey:KOrderId];
}

+ (void)saveOrderPrice:(NSString *)price
{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    [userDefaults setObject:price forKey:KOrderPrice];
}

+ (void)saveMaterialId:(NSString *)MaterialId
{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    [userDefaults setObject:MaterialId forKey:KMaterialId];
}

+ (void)saveMessageWarn:(NSString *)value
{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    [userDefaults setObject:value forKey:KMessageWarn];
}

+ (void)saveSystemSound:(NSString *)value
{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    [userDefaults setObject:value forKey:KSystemSound];
}

+ (void)saveVibration:(NSString *)value
{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    [userDefaults setObject:value forKey:KVibration];
}

+ (void)saveNickName:(NSString *)value
{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    [userDefaults setObject:value forKey:KNickName];
}

+ (void)saveMidiID:(NSString *)value
{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    [userDefaults setObject:value forKey:KMidiId];
}

+ (NSString *)takePayItem
{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    
    return [userDefaults objectForKey:KPayItem];
}

+ (NSString *)takePayMusicPopToView
{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    
    return [userDefaults objectForKey:KPayBuyMusicPopToInterface];
}

+ (NSString *)takePayResult
{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    
    return [userDefaults objectForKey:KPayResult];
}

+ (NSString *)takeExamId
{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    
    return [userDefaults objectForKey:KExamId];
}

+ (NSString *)takeOrderId
{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    
    return [userDefaults objectForKey:KOrderId];
}

+ (NSString *)takeOrderPrice
{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    
    return [userDefaults objectForKey:KOrderPrice];
}

+ (NSString *)takeMaterialId
{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    
    return [userDefaults objectForKey:KMaterialId];
}

+ (NSString *)takeMessageWarn
{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    
    return [userDefaults objectForKey:KMessageWarn];
}

+ (NSString *)takeSystemSound
{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    
    return [userDefaults objectForKey:KSystemSound];
}

+ (NSString *)takeVibration
{
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    
    return [userDefaults objectForKey:KVibration];
}




@end
























